@extends('mobile.layout1')
@section('title','订单')
@section('content')
    <body>
    <div class="view-container view-order">
        <div class="view-inner">
            <!-- 订单信息 -->
            <section class="order-head-bar">
                <i class="if if-order"></i>
                <h4>订单状态：@if($order->closed) 订单已关闭 @elseif($order->paid_at) 已支付 @else 待支付 @endif</h4>
                @if($order->paid_at)<h4>物流状态：{{\App\OrderPay::$shipStatusMap[$order->ship_status]}}</h4> @endif
                @if($order->refund_status==\App\OrderPay::REFUND_STATUS_APPLIED) 退款状态:{{\App\OrderPay::$refundStatusMap[$order->refund_status]}} @endif
                <p>订单号：{{$order->pay_sn}}</p>
                <p>订单金额：￥{{$order->pay_price}}</p>
            </section>
            <!-- 配送 -->
            <section class="order-express">
                <div class="selected-logis">
                    <!-- 有默认地址时显示 -->

                    @if($order->address_id)
                <a class="address">
                            <div class="address-info clearfix">
                                <span class="address-name">收货人: {{$order->address->consignee}}</span>
                                <span class="address-phone">电话: {{$order->address->mobile}}</span>
                            </div>
                            <div class="address-detail"> {{$order->address->province}} {{$order->address->city}} {{$order->address->district}}{{$order->address->address}}</div>
                </a>
                        <input type="hidden" name="address_id" id="address_id" value="{{$order->address->address_id}}">
                    @elseif(isset($address))

                        <a href="##" class="address confirm-change-address-btn">
                            <div class="address-info clearfix">
                                <span class="address-name">收货人: {{$address->consignee}}</span>
                                <span class="address-phone">{{$address->mobile}}</span>
                            </div>
                            <div class="address-detail"> {{$address->province}} {{$address->city}} {{$address->district}}{{$address->address}}</div>
                        </a>
                        <input type="hidden" name="address_id" id="address_id" value="{{$address->address_id}}">
                    @else
                        <a class="add-address confirm-add-address-btn" href="#">未填写</a>
                    @endif
                </div>
            </section>
            <!-- 商品 -->
            <section class="order-goods">
                <ul class="cart-list confirm-cart">
                    @if(isset($order->goods)&&count($order->goods))
                        @foreach($order->goods as $v)
                            <li>
                                <div class="item-info">
                                    <a href="{{route('goods.show',['id'=>$v->good_object['goods_id']])}}"
                                       class="item-image">
                                        <img src="{{$v->good_object['goods_thumbnail']}}">
                                    </a>
                                    <a href="{{route('goods.show',['id'=>$v->id])}}"
                                       class="item-title">{{$v->good_object['goods_name']}}</a> <span
                                            class="item-price">￥{{$v->good_price}}</span>
                                    <span class="quantity">× {{$v->good_object['buy_num']}}</span>
                                    <div class="item-sku-quantity">
                                        <span class="props"></span>
                                    </div>
                                </div>
                            </li>
                        @endforeach
                    @endif
                </ul>
                <div class="order-delivery">运费 <span class="pull-right shipemnt-fee-num">￥免运费</span></div>  <div class="order-delivery">优惠券 <span class="pull-right shipemnt-fee-num">@if(isset($order->coupons))￥- {{$order->coupons->coupon_object['money']}} @else 无优惠券信息 @endif</span></div>

                <div class="goods-subtotal">
                    <span>共<em>{{$order->total_num}}</em>件商品</span> 实际付款:<strong
                            class="amount-sum-num">￥{{$order->pay_price}}</strong>
                </div>
                <div class="order-time">
                    <div>成交时间：{{$order->paid_at}}</div>
                </div>
            </section>
            <!-- 待支付订单的时候使用 -->

            <div>
                <section class="order-pay">
                    @can('candleOrder',$order)
                        <button type="button" class="btn btn-block payment-btn btn-success payment-llpay" onclick="orderCancel({{$order->pay_id}})">取消订单</button>
                    @endcan
                        @can('sureOrder',$order)
                        <button type="button" class="btn btn-block payment-btn btn-success payment-llpay"
                                onclick="delivered({{$order->order_pay_id}})">确认收货
                        </button>

                        <button type="button" class="btn btn-block payment-btn btn-success payment-llpay"
                                onclick="javascript:location.href='/my/order/express?order_id={{$order->order_pay_id}}'">查看物流状态
                        </button>
                    @endcan
                </section>
            </div>
            </section>
        </div>
    </div>
    </body>
    @endsection
    </html>